// part1:C06:ex6.10.cpp
// pointer to swap two integer.
#include <iostream>
using namespace std;

void swap1(int *n1, int *n2) {
  int tmp = *n1;
  *n1 = *n2;
  *n2 = tmp;
}

int main(void) {
  int a = 5, b = 10;
  int *pa = &a, *pb = &b;
  cout << "a = " << a << " b = " << b << endl;
  swap1(pa, pb);
  cout << "after a = " << a << " b = " << b << endl;

  return 0;
}
